*************************************************************************
*																		*
*	Present descriptive results: Table 4, Fig 12.2 & Fig 12.3			*
*																		*
*************************************************************************

* Project: "Voting in Context" Book
* Chapter: "Always late? Stability and change in individuals‘ time of vote decisions"
* Author: Maria Preißinger 
* Date: Feb 2017


*-------------------------------------------
* Data management
*-------------------------------------------

/* Reduce data set in order to speed up data reshaping
which is neccessary for producing stapled bar graphs */

keep newid0913 ?_timedeci2b a_panelcongtvduell6 b_panelcongtvduell5 ///
	?_timetalk ?_timecontact ?_timeard ?_timezdf
	
save "alwayslate_descriptivegraphdata", replace	


*----------------------------------------------------------------------
* Table 12.4: Intra-individual variation in time of final decision
*------------------------------------------------------------------------

estimates clear
estpost tab a_timedeci2b b_timedeci2b

esttab using "table 4.rtf", ///
	replace cells(rowpct(fmt(0)) b) unstack ///
	title("Table 4: Intra-individual variation in Time of Final Vote Decision 2009 & 2013")

*-------------------------------------------------------------------------------
* Fig 12.2: 2009 & 2013 Time of Final Vote Decision
*-------------------------------------------------------------------------------

rename a_timedeci2b f1
rename b_timedeci2b f2

reshape long f, i(newid0913)
tab f, gen(goo) nof
fre goo*


label define a_panel 1"2009" 2"2013" 	
lab value _j a_panel


graph bar goo1-goo6, over(_j) stack per asyvar scheme(s1mono) ///
	ytitle("Share (in %)", margin(medium)) ///
	b2title("Time of Final Vote Decision") label ///
	legend(row(2) lab(1 "wave 2") lab(2 "wave 3") lab(3 "wave 4") ///
	lab(4 "wave 5") lab(5 "wave 6") lab(6 "wave 7")) ylabel(0(10)100, angle(0))

	
graph export "fig 12_2.png", replace width(2000) height(1000)		



*-------------------------------------------------------------------------------
* Fig 12.3: Time of first congruent message received 2009 & 2013
*-------------------------------------------------------------------------------

* 2009
use "alwayslate_descriptivegraphdata", clear


rename a_timetalk f2
rename a_timecontact f3
rename a_panelcongtvduell6 f4
rename a_timeard f5
rename a_timezdf f6

recode f4 1=6
reshape long f, i(newid0913)
tab f, gen(goo) nof
fre goo*


label define a_panel 2"Talk" 3"Contact" ///
	4"Debate" 5"ARD" 6"ZDF", modify
lab value _j a_panel


graph bar goo1-goo6, over(_j) stack per asyvar scheme(s1mono) ///
	ytitle("") ///
	ylabel(0(10)100, angle(0)) ///
	title("2009") label name(komm2009, replace) ///
	legend(row(2) label(1 "never") lab(2 "wave 2") lab(3 "wave 3") ///
	lab(4 "wave 4") lab(5 "wave 5") lab(6 "wave 6")) 

	
* 2013
use "alwayslate_descriptivegraphdata", clear


rename b_timetalk f2
rename b_timecontact f3
rename b_panelcongtvduell5 f4
rename b_timeard f5
rename b_timezdf f6

recode f4 1=5
reshape long f, i(newid0913)
tab f, gen(goo) nof
fre goo*


label define b_panel 2"Talk" 3"Contact" ///
	4"Debate" 5"ARD" 6"ZDF", modify
lab value _j b_panel


graph bar goo1-goo6, over(_j) stack per asyvar scheme(s1mono) ///
	ytitle("") ///
	title("2013") label ylabel(0(10)100, angle(0)) ///
	legend(row(2) label(1 "never") lab(2 "wave 2") lab(3 "wave 3") ///
	lab(4 "wave 4") lab(5 "wave 5") lab(6 "wave 6")) ///
	name(komm2013, replace)

* Combine graphs from 2009 & 2013
grc1leg komm2009 komm2013, scheme(s1mono) l1title("Share (in %)")
graph export "fig12_3.png", width(2000) height(1000) replace


